//
//  UIView+Corner.h
//  iOSHelper
//
//  Created by LL on 2020/6/16.
//  Copyright © 2020 Chair. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIView (Corner)

 
/** 边框位置 */
typedef NS_ENUM(NSInteger, FCBorderPosition) {
    FCBorderPositionTop     = 1 << 0,
    FCBorderPositionLeft    = 1 << 1,
    FCBorderPositionBottom  = 1 << 2,
    FCBorderPositionRight   = 1 << 3,
    FCBorderPositionAll     = FCBorderPositionTop | FCBorderPositionLeft | FCBorderPositionBottom | FCBorderPositionRight,
};
 
/**
 给view添加一个带箭头的边框
 
 @param direction 箭头朝向
 @param offset 箭头的坐标，如果是在左右朝向，传箭头中心位置的y值；如果是上下朝向，传箭头中心位置x值
 @param width 箭头的宽度
 @param height 箭头的高度
 @param cornerRadius 圆角半径，<=0不设圆角
 @param borderWidth 边框宽度
 @param borderColor 边框颜色
 */
- (void)addArrowBorderAt:(FCBorderPosition)direction offset:(CGFloat)offset width:(CGFloat)width height:(CGFloat)height cornerRadius:(CGFloat)cornerRadius borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor;

/// 设置圆角
- (void)setCorner:(UIRectCorner)corner cornerRadii:(CGSize)size;

- (void)setCorner:(UIRectCorner)corner cornerRadius:(CGFloat)radius;

- (void)addCornersAndShadow;

- (void)addCorners:(UIRectCorner)corners
       shadowLayer:(void (^)(CALayer * shadowLayer))shadowLayer;

- (void)addCorners:(UIRectCorner)corners
            rRadii:(CGFloat)rRadii;

/*
@param corners 圆角设置
@param rRadii 圆角设置
@return shadowLayer 阴影设置
*/
- (void)addCorners:(UIRectCorner)corners
            rRadii:(CGFloat)rRadii
       shadowLayer:(nullable void (^)(CALayer * shadowLayer))shadowLayer;

@end

NS_ASSUME_NONNULL_END
